home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / MPW Oberon 2.1168 / OInterfaces / CursorCtl.mod < prev    next >
Encoding:
Text File  |  1995-08-10  |  5.6 KB  |  137 lines  |  [TEXT/MPS ]

  1. (*
  2.     File:        CursorCtl.mod
  3.  
  4.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease. Jan 2, 1995
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs.applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. *)
  16.  
  17. (*$TAGS-*)
  18. (*$CALLING PASCAL*)
  19. MODULE CursorCtl;
  20.  
  21. IMPORT SYSTEM;
  22.  
  23. (* $PUSH*)
  24. (* $ALIGN MAC68K*)
  25.  
  26. TYPE
  27.  
  28. (* Kinds of cursor supported by CursorCtl *)
  29. (*ΔΔ Cursors* = (HIDDEN_CURSOR,I_BEAM_CURSOR,CROSS_CURSOR,PLUS_CURSOR,WATCH_CURSOR,
  30.     ARROW_CURSOR);*)
  31. Cursors* = SHORTINT;
  32. CONST
  33. HIDDEN_CURSOR* = 0; I_BEAM_CURSOR* = 1; CROSS_CURSOR* = 2;
  34. PLUS_CURSOR* = 3; WATCH_CURSOR* = 4; ARROW_CURSOR* = 5;
  35. TYPE
  36.  
  37. acurPtr* = POINTER TO Acur;
  38. acurHandle* = HANDLE TO Acur (*ΔΔ POINTER TO acurPtr*);
  39. Acur* = RECORD
  40.     n*: INTEGER;         (*Number of cursors ("frames of film")*)
  41.     index*: INTEGER;     (* Next frame to show <for internal use>*)
  42.     frame1*: INTEGER;    (*LONG("CURS") resource id for frame #1*)
  43.     fill1*: INTEGER;     (*<for internal use>*)
  44.     frame2*: INTEGER;    (*LONG("CURS") resource id for frame #2*)
  45.     fill2*: INTEGER;     (*<for internal use>*)
  46.     frameN*: INTEGER;    (*LONG("CURS") resource id for frame #N*)
  47.     fillN*: INTEGER;     (*<for internal use>*)
  48.     END;
  49.  
  50.  
  51.  
  52. PROCEDURE InitCursorCtl*(newCursors: (*ΔΔUNIVΔΔ*) acurHandle);
  53. (* Initialize the CursorCtl unit. This should be called once prior to calling
  54. RotateCursor or SpinCursor. It need not be called if only Hide_Cursor or
  55. Show_Cursor are used. If NewCursors is NULL, InitCursorCtl loads in the
  56. LONG("acur") resource and the LONG("CURS") resources specified by the LONG("acur") resource
  57. ids.  If any of the resources cannot be loaded, the cursor will not be
  58. changed.
  59.  
  60. The LONG("acur") resource is assumed to either be in the currently running tool or
  61. application, or the MPW Shell for a tool, or in the System file.  The LONG("acur")
  62. resource id must be 0 for a tool or application, 1 for the Shell, and 2 for
  63. the System file.
  64.  
  65. If NewCursors is not NULL, it is ASSUMED to be a handle to an LONG("acur") formatted
  66. resource designated by the caller and it will be used instead of doing a
  67. GetResource on LONG("acur"). Note, if RotateCursor or SpinCursor are called without
  68. calling InitCursorCtl, then RotateCursor and SpinCursor will do the call for
  69. the user the first time it is called.  However, the possible disadvantage of
  70. using this technique is that the resource memory allocated may have
  71. undesirable affect (fragmentation?) on the application. Using InitCursorCtl
  72. has the advantage of causing the allocation at a specific time determined by
  73. the user.
  74.  
  75. Caution: InitCursorCtl MODIFIES the LONG("acur") resource in memory.    Specifically,
  76. it changes each FrameN/fillN integer pair to a handle to the corresponding
  77. LONG("CURS") resource also in memory.  Thus if NewCursors is not NULL when
  78. InitCursorCtl is called, the caller must guarantee NewCursors always points to
  79. a "fresh" copy of an LONG("acur") resource.  This need only be of concern to a
  80. caller who wants to repeatly use multiple LONG("acur") resources during execution of
  81. their programs.
  82.  *)
  83. EXTERNAL PASCAL;
  84.  
  85. PROCEDURE RotateCursor*(counter: LONGINT);
  86. (* RotateCursor is called to rotate the "I am active" "beach ball" cursor, or to
  87. animate whatever sequence of cursors set up by InitCursorCtl. The next cursor
  88. ("frame") is used when Counter   32* = 0 (Counter is some kind of incrementing
  89. or decrementing index maintained by the caller). A positive counter sequences
  90. forward through the cursors (e.g., it rotates the "beach ball" cursor
  91. clockwise), and a negative cursor sequences through the cursors backwards
  92. (e.g., it rotates the "beach ball" cursor counterclockwise).  Note,
  93. RotateCursor just does a Mac SetCursor call for the proper cursor picture.
  94.   It is assumed the cursor is visible from a prior Show_Cursor call.
  95.  *)
  96. EXTERNAL PASCAL;
  97.  
  98. PROCEDURE SpinCursor*(increment: INTEGER);
  99. (* SpinCursor is similar in function to RotateCursor, except that instead of
  100. passing a counter, an Increment is passed an added to a counter maintained
  101. here.  SpinCursor is provided for those users who do not happen to have a
  102. convenient counter handy but still want to use the spinning "beach ball"
  103. cursor, or any sequence of cursors set up by InitCursorCtl.  A positive 
  104. increment sequences forward through the curos (rotating the "beach ball"
  105. cursor clockwise), and a negative increment sequences backward through the
  106. cursors (rotating the "beach ball" cursor counter-clockwise).  A zero value
  107. for the increment resets the counter to zero.  Note, it is the increment, and
  108. not the value of the counter that determines the sequencing direction of the
  109. cursor (and hence the spin direction of the "beach ball" cursor).
  110.  *)
  111. EXTERNAL PASCAL;
  112.  
  113. PROCEDURE Hide_Cursor*;
  114. (* Hide the cursor if it is showing.This is this unit's call to the Mac
  115. HideCursor routine.Thus the Mac cursor level is decremented by one when this
  116. routine is called.
  117.  *)
  118. EXTERNAL PASCAL;
  119.  
  120. PROCEDURE Show_Cursor*(cursorKind: Cursors);
  121. (* Increment the cursor level, which may have been decremented by Hide_Cursor,
  122. and display the specified cursor if the level becomes 0 (it is never
  123. incremented beyond 0).The CursorKind is the kind of cursor to show.  It is
  124. one of the values HIDDEN_CURSOR, I_BEAM_CURSOR, CROSS_CURSOR, PLUS_CURSOR,
  125. WATCH_CURSOR, and ARROW_CURSOR. Except for HIDDEN_CURSOR, a Mac SetCursor is
  126. done for the specified cursor prior to doing a ShowCursor.    HIDDEN_CURSOR just
  127. causes a ShowCursor call.  Note, ARROW_CURSOR will only work correctly if
  128. there is already a grafPort set up pointed to by 0(A5).
  129.  *)
  130. EXTERNAL PASCAL;
  131.  
  132.  
  133. (* $ALIGN RESET*)
  134. (* $POP*)
  135.  
  136.     END CursorCtl.
  137.